package com.fengmi.mapper;


import com.fengmi.dto.PageDTO;
import com.fengmi.dto.ProductDTO;
import com.fengmi.entity.MallGoods;
import com.fengmi.entity.MallGoodsSku;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 作者：陈学虎
 * 时间：2021/7/11 0011 下午 7:33
 */
@Mapper
public interface GoodsMapper {


    public List<MallGoods> findGoods(ProductDTO productDTO);

    @Update("update mall_goods set is_marketable = #{isMarketable} where spu_id = #{spuId} ")
    public int changeGoodStatus(MallGoods mallGoods);

    //保存spu
    public int saveSpu(MallGoods mallGoods);

    //保存sku
//    @Insert("insert into mall_goods_sku (sku_title,sku_price,sku_stock," +
//            "sku_low_stock,spu_id) values(#{skuTitle}," +
//            "#{skuPrice},#{skuStock},#{skuLowStock},#{spuId})")
    public int saveSku(MallGoodsSku mallGoodsSku);


    //删除 存在的sku
    @Delete("delete from mall_goods_sku where spu_id = #{spuId} ")
    public int delBySupId(String spuId);

}
